﻿using Architecture.Api.Application.Command.MenuCommand;
using Architecture.Domain.RBAC;
using Architecture.Service;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.MenuHandler
{
    public class MenuBackfillCommandHandler : IRequestHandler<MenuBackfillCommand, Menu>
    {
        protected readonly IMenuService _menuService;

        public MenuBackfillCommandHandler(IMenuService menuService)
        {
            _menuService = menuService;
        }
        public async Task<Menu> Handle(MenuBackfillCommand request, CancellationToken cancellationToken)
        {
            return await _menuService.GetByIdAsync(request.MenuId);
        }
    }
}
